package leetcode.median;

/**
 * ClassName: $518_Change
 * Description:
 * date: 2022-01-29 20:29
 *
 * @author liyifan
 */
public class $518_Change {
    public int change(int amount, int[] coins) {
        if(coins.length == 0)
            return 0;
        int n = coins.length;
        int[] dp = new int[amount + 1];
        dp[0] = 1;

        for (int i = 1;i <= n;i++) {
            int coin = coins[i - 1];
            for (int j = coin;j <= amount;j++) {
                dp[j] += dp[j - coin];
            }
        }
        return dp[amount];

    }
}
